<template>
  <div class="benefit-hb-history-item">
    <div class="bg"></div>
    <div class="main">
      <div class="left">
        <span class="amount"
          >¥<i class="number-1 number">{{ number1 }}</i>
          <i class="number-2 number">{{ number2 }}</i></span
        >
        <span class="condition">{{ item.description_map.sum_condition }}</span>
      </div>
      <div class="center">
        <p class="name">{{ item.name }}</p>
        <p class="expire">{{ item.description_map.validity_periods }}</p>
        <p class="phone">{{ item.description_map.phone }}</p>
      </div>
      <div class="right">
        <svg class="svg">
          <use xlink:href="#expiration-mark" />
        </svg>
      </div>
    </div>
    <div class="limit" v-if="item.limit_map">
      {{item.limit_map.restaurant_flavor_ids}}
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  computed: {
    number1() {
      const amount = String(this.item.amount).split(".");
      return amount[1] ? `${amount[0]}.` : `${this.item.amount}.`;
    },
    number2() {
      const amount = String(this.item.amount).split(".");
      return amount[1] ? amount[1] : 0;
    },
  },
};
</script>
<style lang="less" scoped>
.benefit-hb-history-item {
  margin: 10px;
  border-radius: 5px;
  background-color: #fff;
  font-size: 12px;
  color: #dddddd;
  overflow: hidden;
  .bg {
    height: 5px;
    background-image: url("~assets/img/profile/expired.png");
    background-size: auto 100%;
  }
  .main {
    display: flex;
    padding: 20px 0;
    .left,.center,.right {
      padding: 0 10px;
    }
    .left {
      display: flex;
      flex-direction: column;
      .amount .number-1,
      .amount .number-2 {
        font-style: normal;
      }
      .amount {
        font-weight: 700;
        font-size: 20px;
        .number-1,
        .number-2 {
          font-style: normal;
        }
        .number-1 {
          font-size: 35px;
        }
      }
      .condition {
        font-size: 10px;
      }
    }
    .center {
      flex: 1;
      border-left: 2px dotted #e2e2e2;
      .name {
        font-size: 14px;
        color: #666666;
      }
      .expire {
        margin: 5px 0;
      }
    }
    .right {
      .svg {
        position: relative;
        top: -10px;
        width: 64px;
        height: 64px;
      }
    }
  }
  .limit {
    padding: 10px 20px;
    background-color: #f9f9f9;
    font-size: 10px;
    color: #b7b7b7;
  }
}
</style>